﻿using System.Configuration;


namespace TipokHostManager.Configuration
{
    public class MachineElementCollection : ConfigurationElementCollection
    {
        private static ConfigurationPropertyCollection _properties = new ConfigurationPropertyCollection();

        protected override ConfigurationElement CreateNewElement()
        {
            return new MachineElement();
        }

        protected override string ElementName
        {
            get
            {
                return "add";
            }
        }

        protected override object GetElementKey(ConfigurationElement element)
        {
            return ((MachineElement)element).IP;
        }

        public MachineElement Get(int index)
        {
            return (MachineElement)base.BaseGet(index);
        }

        public MachineElement Get(string name)
        {
            return (MachineElement)base.BaseGet(name);
        }

        public new MachineElement this[string key]
        {
            get { return (MachineElement)base.BaseGet(key); }
        }

        public override ConfigurationElementCollectionType CollectionType
        {
            get
            {
                return ConfigurationElementCollectionType.BasicMap;
            }
        }

        protected override ConfigurationPropertyCollection Properties
        {
            get
            {
                return _properties;
            }
        }
    }
}
